const path = require('path');
const fileList = require('./config');
const fileHelper = require('./fileHelper');
const docGenerator = require('./docGenerator');

const FOLDER_NAME = "旅客操作";
const OUTPUT_PATH = path.join(__dirname, FOLDER_NAME);

(async () => {
  try {
    // 创建目标目录
    fileHelper.createFolder(OUTPUT_PATH);

    // 批量生成文档
    for (const fileName of fileList) {
      const buffer = await docGenerator.generateDocTemplate(fileName);
      fileHelper.saveDocument(OUTPUT_PATH, fileName, buffer);
    }

    console.log(`🎉 文档生成完成，共创建 ${fileList.length} 个文件`);
  } catch (error) {
    console.error(`❌ 生成失败：`, error);
  }
})();